using System;
using System.Collections.Generic;
using Orchard;

namespace Bootstrap.Models {
    public interface IBootstrapVariable : IDependency {
        void Describe(VariableDescriptionContext context);
    }
    
    public class VariableDescriptor {
        public string Name { get; set; }
        public int DisplayPriority { get; set; }
        public IBootstrapVariableSection Section { get; set; }
        
        public VariableDescriptor WithSection(IBootstrapVariableSection section, int displayPriority) {
            Section = section;
            DisplayPriority = displayPriority;
            return this;
        }
    }

    public class VariableDescriptionContext {
        public Dictionary<string, Func<VariableDescriptor, VariableDescriptor>> Variables { get; private set; }
        public VariableDescriptionContext() {
            Variables = new Dictionary<string, Func<VariableDescriptor, VariableDescriptor>>();
        }
        public VariableDescriptionContext Describe(string name, Func<VariableDescriptor,VariableDescriptor> descriptor)
        {
            Variables.Add(name, descriptor);
            return this;
        }
    }
}